/**
 * Cookie工具（原生）
 *
 * 摘自腾讯qq第三方登录SDK qc_loader.js
 */
var $Cookie = function() {
    var domainPrefix = document.domain || "";
    return {
        set: function(name, value, domain, path, hour) {
            if (hour) {
                var expire = new Date();
                expire.setTime(expire.getTime() + 3600000 * hour);
            }
            document.cookie = name + "=" + value + "; " + (hour ? ("expires=" + expire.toGMTString() + "; ") : "") + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + domainPrefix + ";"));
            return true;
        },
        get: function(name) {
            var r = new RegExp("(?:^|;+|\\s+)" + name + "=([^;]*)")
              , m = document.cookie.match(r);
            return (!m ? "" : m[1]);
        },
        del: function(name, domain, path) {
            document.cookie = name + "=; expires=Mon, 26 Jul 1997 05:00:00 GMT; " + (path ? ("path=" + path + "; ") : "path=/; ") + (domain ? ("domain=" + domain + ";") : ("domain=" + domainPrefix + ";"));
        }
    }
}();